
let group = ['569211842','363457102'];//群号改我,多个可以 , 分割
let yoyo = null;
const path = `./plugins/nodejs/yoyorobot/llseapi.js`;//机器人api版本
const parallelTable = new JsonConfigFile('./plugins/Yoyo/DeathRobot/parallelTable.json', '{}');
if (File.exists(path)) {
    const yoyorobot = require(`./nodejs/yoyorobot/llseapi.js`);
    // 玩家死亡
    yoyorobot(yo => {
        yoyo = yo;
    });

    let causeKey = ['死亡了', '死于太作了', '被 {} 杀了', '被 {} 射杀了', '窒息了', '摔死了', '被烤熟了', '被点燃了', '试图在岩浆里洗澡', '溺水了', '被炸飞了', '被 {} 炸飞了', '掉出了这个世界', '自杀了', '被魔法杀死了', '凋零了', '饿死了,大家可怜一下', '被铁砧砸死了', '被扎死了', '被砸死了', '被活塞捅了', '撞死了', '岩浆块烫没了', '被烟花炸飞了', '被雷劈了,少发誓'];

    mc.listen("onMobDie", (mob, source, cause) => {
        if (mob.isPlayer()) {
            let pl = mob.toPlayer();
            let causeMsg = cause > causeKey.length ? '嗝屁了' : causeKey[cause];
            if (source) {
                if (source.isPlayer()) {
                    let toPl = source.toPlayer();
                    causeMsg = causeMsg.replace(/{}/g, toPl.realName);
                } else {
                    let enName = parallelTable.get(source.type);
                    if (!enName) {
                        enName = `${toPl.type}(未配置)`;
                        parallelTable.set(toPl.type, '');
                    }
                    causeMsg = causeMsg.replace(/{}/g, enName);
                }
            }
            group.forEach(v => {
                yoyo.client.sendGroupMsg(v, `[玩家嗝屁] ${pl.name} ${causeMsg}`);
            });
        }
    });

} else {
    logger.error(`未找到 Yoyorobot llseApi 版本库 请安装YoyoRobot机器人新版本!`);
}


